<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取对象</title>
</head>
<body>
    <div>
        hello word
    </div>
   <ul class="nav">
       <li>我是首页</li>
       <li>产品介绍</li>
       <li>联系方式</li>
   </ul>
</body>
<script>
    // 根据标签名字和css选择器去获取
    let div=document.querySelector('div')
    console.log(div);
    //获取全部的元素，得到的是伪数组，只有长度
    let allLi=document.querySelectorAll('li')
    console.log(allLi);
    for(var i=0;i<allLi.length;i++){
        console.log(allLi[i]);
    }
</script>
</html>